//
//  AboutViewController.m
//  ExpressData
//
//  Created by user on 11/30/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "AboutViewController.h"
#import "OurHistoryViewController.h"
#import "AboutEDViewController.h"

#define aboutEDTab 0
#define ourHistoryTab 1

@implementation AboutViewController

@synthesize tabBar;
@synthesize ourHistoryViewController;
@synthesize aboutEDViewController;

- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item {
		switch (item.tag) {
			
			
	
		case aboutEDTab:
		{
			
			[self clearView];
			 aboutEDViewController.view.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
			[self.view insertSubview:aboutEDViewController.view atIndex:0];		
		
			break;
		}
		case ourHistoryTab:
		{
			
			[self clearView];
			ourHistoryViewController.view.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
			[self.view insertSubview:ourHistoryViewController.view atIndex:0];
			break;
		}	
		default:
			break;
	}

}

-(void) clearView {
	if (aboutEDViewController.view.superview) {
		[aboutEDViewController.view removeFromSuperview];
	} else if (ourHistoryViewController.view.superview) {
		[ourHistoryViewController.view removeFromSuperview];
	}
}
/*
 // The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
        // Custom initialization
    }
    return self;
}
*/


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {

	[super viewDidLoad];

	self.title = @"About Us";
	self.tabBar.selectedItem = [self.tabBar.items objectAtIndex:0];
    [self.view insertSubview:aboutEDViewController.view atIndex:0];
//	[self.view insertSubview:ourHistoryViewController.view atIndex:0];
	

}



// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return YES;
}


- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {

	[super viewDidUnload];

    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}


- (void)dealloc {
    [super dealloc];
}


@end
